﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dukous.Search;
using Dukous.Security.Domain;

namespace Dukous.Security.BizService.Searchers
{
    public class UserSearcher : ISearcher
    {
        public ISearchSupport<User> SearchSupport { get; set; }

        #region ISearcher 成员

        public ISearchResult Search(ISearchContext context)
        {
            int totalCount = 0;

            IList<User> results = this.SearchSupport.SelectBySearch(context, out totalCount);

            SearchResult result = new SearchResult(context, totalCount);
            foreach (User item in results)
            {
                result.AddItem(new PropertySearchResultItem(item).Id<long>(item.Id));
            }
            return result;
        }

        #endregion
    }
}
